package com.baizhi.service.advice;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

public class MySuroundAdvice implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        Object result = null;
        try {
            System.out.println("环绕通知里面的前置通知。。。。。");
            //执行目标方法。
            result = invocation.proceed();
            System.out.println("环绕通知里面的后置通知。。。。。");
        } catch (Throwable throwable) {
            System.out.println("环绕通知里面的异常通知。。。。。");
            throwable.printStackTrace();
        }
        return result;
    }
}
